package jdwl.hrmgrsys.pojo;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import jdwl.hrmgrsys.pojo.core.CommonPara;

/**
 * 企业，雇佣员工
 * 
 * @author Huangdian
 * 
 */
@Entity
@Table(name = "enterprise")
public class Enterprise {
	@OneToOne(cascade = CascadeType.PERSIST, targetEntity = CommonPara.class, fetch = FetchType.EAGER)
	@JoinColumn(name = "type_code", referencedColumnName = "code")
	private CommonPara enterpriseType;// 企业类型

	@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "enterprise", targetEntity = HR.class)
	private HR hr;

	@Id
	@GeneratedValue
	@Column(name = "id")
	private Integer id;

	private String name, address, introduce, remark, contact, representative;

	/**
	 * 企业的员工集合
	 */
	@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, targetEntity = Staff.class, mappedBy = "enterprise")
	private Set<Staff> staffList = new HashSet<Staff>();

	public String getAddress() {
		return address;
	}

	public String getContact() {
		return contact;
	}
	public CommonPara getEnterpriseType() {
		return enterpriseType;
	}

	public HR getHr() {
		return hr;
	}

	public Integer getId() {
		return id;
	}

	public String getIntroduce() {
		return introduce;
	}

	public String getName() {
		return name;
	}

	public String getRemark() {
		return remark;
	}

	public String getRepresentative() {
		return representative;
	}

	public Set<Staff> getStaffList() {
		return staffList;
	}

	public CommonPara getType() {
		return enterpriseType;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public void setContact(String contact) {
		this.contact = contact;
	}

	public void setEnterpriseType(CommonPara enterpriseType) {
		this.enterpriseType = enterpriseType;
	}

	public void setHr(HR hr) {
		this.hr = hr;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public void setIntroduce(String introduce) {
		this.introduce = introduce;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public void setRepresentative(String representative) {
		this.representative = representative;
	}

	public void setStaffList(Set<Staff> staffList) {
		this.staffList = staffList;
	}

	public void setType(CommonPara type) {
		this.enterpriseType = type;
	}

}
